<?php

include '../connectBDD.php';
if (isset($_GET['id_dj'])) {
    $id_dj = $_GET['id_dj'];
    $query = "DELETE FROM dj WHERE id_dj = '$id_dj'";

    mysql_query($query) or die(mysql_error());

    //Recherche Personnes
    $result = mysql_query("SELECT id_dj, pseudo_dj FROM dj");
    $nb_res = mysql_num_rows($result);
    echo "<a href=javascript:ouvrirFenetre('creationDJ.php')>Creer un nouveau DJ</a></div>";

    echo "<div style='color:green'>$nb_res DJ's trouvés</div>";
    if (mysql_num_rows($result) <= 0) {
        echo "<div class='no_result_found'>Aucun DJ.</div>";
    } else {
        echo "<div class='djs'>";
        while ($row = mysql_fetch_assoc($result)) {

            echo"
                         <div id='dj'>
                         " . $row['pseudo_dj'] . "
                            <div style='float:right'>
                                <a class='edit_data' href=\"javascript:ouvrirFenetre(url)\"><img src='../images/Edit_Yes_32.png' /></a>
                                <a class='croix_ferm' href=\"javascript:supprimerDJ('" . $row['id_dj'] . "')\"><img src='../images/Close-32.png' height='15px' width='15px'/></a>
                            </div>
                        </div>";
        }
        echo "</div>";
    }
}
?>
